<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <meta name="cdnload" content="vue,vant-js,vant-css" />
    <link rel="stylesheet" href="/assets/css/css3-flex.css" />
    <link rel="stylesheet" href="./style.css" />
    <title>042-WebSocket的研究</title>
  </head>

  <body>
    <div id="app">
      <div class="main">
        <div v-for="(item, index) in messageList" :key="index" :class="{ is_me: item.user == user }">
          <div v-if="item.type == 'join'" class="join_box">{{ item.user }} 加入了聊天</div>
          <div v-else>
            <div class="user_box">{{ item.user }}</div>
            <div class="item_box">
              <div class="content">{{ item.data }}</div>
            </div>
          </div>
        </div>
      </div>
      <div class="foot_input">
        <van-row class="ac">
          <van-col span="20">
            <van-field
              class="textarea_box"
              v-model.trim="message"
              rows="3"
              type="textarea"
              maxlength="500"
              placeholder="请输入内容"
              show-word-limit
            ></van-field>
          </van-col>
          <van-col span="4" class="jac">
            <van-button type="primary" size="mini" @click="sendMessage">发送</van-button>
          </van-col>
        </van-row>
      </div>
    </div>
    <script defer type="module" src="./042-main.js"></script>
  </body>
</html>
